package cn.tedu.spring.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Component
@PropertySource("classpath:thread.properties")
public class ThreadPoolProperties {
    //@Value("8")
    @Value("${thread.pool.corePoolSize}")
    private int corePoolSize;
    //@Value("32")
    @Value("${thread.pool.maximumPoolSize}")
    private int maximumPoolSize;
    @Value("${thread.pool.keepAliveTime}")
    private int keepAliveTime;
    @Value("${thread.pool.queueCapacity}")
    private int queueCapacity;

    public int getQueueCapacity() {
        return queueCapacity;
    }

    public int getMaximumPoolSize() {
        return maximumPoolSize;
    }

    public int getKeepAliveTime() {
        return keepAliveTime;
    }

    public int getCorePoolSize() {
        return corePoolSize;
    }

    public ThreadPoolProperties(){
        System.out.println("ThreadPoolProperties()");
    }
    @Override
    public String toString() {
        return "ThreadPoolProperties{" +
                "corePoolSize=" + corePoolSize +
                ",maximumPoolSize=" + maximumPoolSize +
                '}';
    }
}
